<template>
  <div class="main">
    <div class="title">
      <h3 class="ellipsis">{{data.title}}</h3>
    </div>
    <div class="back_line">
      <span class="time_show">{{data.createdAt | timeFormat}}</span>
      <span class="read_amount">阅读量:{{data.readingAmount}}</span>
      <span @click="go_Back" class="go_back">返回 >></span>
    </div>
    <div class="content">
      <div v-html="data.content" class="content"></div>
    </div>
  </div>
</template>
<style lang="scss">
  @import "~common/sass/mixin.scss";

  .main {
    width: 90%;
    margin-left: 5%;
  }

  .title {
    height: 40px;
  }

  .title h3 {
    font-size: 16px;
  }

  .back_line {
    width: 100%;
    height: 40px;
    background: rgba(231, 231, 231, 0.2);
    border-bottom: 1px solid rgba(221, 221, 221, 0.5);
  }

  .back_line span {
    line-height: 40px;
    font-size: 12px;
    color: #6c757d;
  }

  .time_show {
    float: left;
    margin-left: 15px;
  }

  .read_amount {
    float: left;
    margin-left: 25px;
  }

  .go_back {
    float: right;
    margin-right: 15px;
  }

  .time_show {
    float: left;
    margin-right: 15px;
  }

  .go_back {
    float: right;
  }

  .content {
    margin-top: 30px;
    padding-bottom: 20%;
  }

  .ellipsis {
    @include ellipsis(1);
    font-size: 16px;
    text-align: center;
  }

  .content p {
    font-size: 12px;
    margin-top: 20px;
    color: #464a4e;
  }
</style>
<script>
  import {getDetail} from '../../http/article'

  export default {
    name: 'informationDetail',
    data() {
      return {
        data: {}
      }
    },
    created() {
      this._getDetail(this.$route.params.id)
    },
    methods: {
      _getDetail(id) {
        getDetail(id).then((res) => {
          this.data = res
        })
      },
      go_Back() {
        this.$router.go(-1)
      }
    }
  }
</script>
